package com.changli.a_Array;

import java.util.Scanner;

public class Demo4Reverse {
    public static void main(String[] args) {
        Scanner sc = new Scanner (System.in);
        int n = sc.nextInt();
        int arr [] = new int [n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        System.out.println("before reverse");

        for (int i =0;i<arr.length;i++) {
            System.out.print(arr[i] + " ");
        }
        //自带整除的效果，无需考奇偶区别;
        for(int i=0;i<arr.length/2;i++){
            int temp = arr[i];
            arr[i] = arr[arr.length-i-1];
            arr[arr.length-i-1] = temp;
        }
        System.out.println("after reverse");

        for(int i =0;i<arr.length;i++){
            System.out.print(arr[i] + " ");
        }

    }
}
